home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PORTABLE.ZIP / WERASE.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  67 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3. #undef werase
  4.  
  5. #ifndef        NDEBUG
  6. char *rcsid_werase = "$Header: c:/curses/portable/RCS/werase.c%v 2.0 1992/11/15 03:29:07 MH Rel $";
  7. #endif
  8.  
  9.  
  10.  
  11.  
  12. /*man-start*********************************************************************
  13.  
  14.   werase()     - copy blanks into window
  15.  
  16.   X/Open Description:
  17.        These functions copy blanks to every position in the window.
  18.  
  19.        NOTE: erase() is a macro.
  20.  
  21.   PDCurses Description:
  22.        There is no additional PDCurses functionality.
  23.  
  24.   X/Open Return Value:
  25.        These functions return OK on success and ERR on error.
  26.  
  27.   PDCurses Errors:
  28.        It is an error to call this function with a NULL window pointer.
  29.  
  30.   Portability:
  31.        PDCurses        int werase( WINDOW* win );
  32.        X/Open Dec '88  int werase( WINDOW* win );
  33.        BSD Curses      int werase( WINDOW* win );
  34.        SYS V Curses    int werase( WINDOW* win );
  35.  
  36. **man-end**********************************************************************/
  37.  
  38. int    werase(WINDOW *win)
  39. {
  40.        chtype* end;
  41.        chtype* start;
  42.        int     y;
  43. static chtype  blank;
  44.  
  45.        if (win == (WINDOW *)NULL)
  46.                return( ERR );
  47.  
  48.        blank = win->_blank | win->_attrs;
  49.  
  50.        for (y = win->_tmarg; y <= win->_bmarg; y++)
  51.        {
  52.                start = win->_y[y];
  53.                end = &start[win->_maxx - 1];
  54. /* changed JGB 6/92 < to <= */
  55.                while (start <= end)
  56.                {
  57.                        *start++ = blank;
  58.                }
  59.                win->_firstch[y] = 0;
  60.                win->_lastch[y] = win->_maxx - 1;
  61.        }
  62.        win->_cury = win->_tmarg;
  63.        win->_curx = 0;
  64.        return( OK );
  65. }
  66.  
  67.